package com.taotao.rest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.TaotaoResult;
import com.taotao.common.utils.ExceptionUtil;
import com.taotao.rest.service.IContentService;

@Controller
@RequestMapping(value = "/content")
public class ContentController {
	@Autowired
	private IContentService contentService;

	/**
	 * 按照内容分类id查询内容信息
	 * 
	 * @param categoryId
	 * @return
	 */
	@RequestMapping(value = "/list/{categoryId}")
	@ResponseBody
	public TaotaoResult getContentList(@PathVariable Long categoryId) {
		try {
			TaotaoResult taotaoResult = this.contentService
					.getContentLlst(categoryId);
			return taotaoResult;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return TaotaoResult.build(500, ExceptionUtil.getStackTrace(e));
		}
	}
}
